package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicWarehouseOtherinDAO;
import com.cssy.xxkj.logic.entity.LogicSalesDO;
import com.cssy.xxkj.logic.entity.LogicWarehouseOtherinDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-09-17
 */
public class LogicWarehouseOtherinDAOImpl extends SqlMapClientDaoSupport implements LogicWarehouseOtherinDAO {

    /**
     * 插入数据
     * @param logicWarehouseOtherinDO
     * @return 插入数据的主键
     */
    public String insertLogicWarehouseOtherinDO(LogicWarehouseOtherinDO logicWarehouseOtherinDO) {
        Object id = getSqlMapClientTemplate().insert("LogicWarehouseOtherin.insert", logicWarehouseOtherinDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicWarehouseOtherinDO
     * @return 查出的记录数
     */
    public Integer countLogicWarehouseOtherinDOByExample(LogicWarehouseOtherinDO logicWarehouseOtherinDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehouseOtherin.countByDOExample", logicWarehouseOtherinDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicWarehouseOtherinDO
     * @return 受影响的行数
     */
    public Integer updateLogicWarehouseOtherinDO(LogicWarehouseOtherinDO logicWarehouseOtherinDO) {
        int result = getSqlMapClientTemplate().update("LogicWarehouseOtherin.update", logicWarehouseOtherinDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicWarehouseOtherinDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicWarehouseOtherinDO> findListByExample(LogicWarehouseOtherinDO logicWarehouseOtherinDO) {
        List<LogicWarehouseOtherinDO> list = getSqlMapClientTemplate().queryForList("LogicWarehouseOtherin.findListByDO", logicWarehouseOtherinDO);
        return list;
    }

    /**
     * 根据主键获取logicWarehouseOtherinDO
     * @param id
     * @return logicWarehouseOtherinDO
     */
    public LogicWarehouseOtherinDO findLogicWarehouseOtherinDOByPrimaryKey(String id) {
        LogicWarehouseOtherinDO logicWarehouseOtherinDO = (LogicWarehouseOtherinDO) getSqlMapClientTemplate().queryForObject("LogicWarehouseOtherin.findByPrimaryKey", id);
        return logicWarehouseOtherinDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicWarehouseOtherinDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicWarehouseOtherin.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicWarehouseOtherinDO> find(SearchConditions scs) throws DataAccessException {
		List<LogicWarehouseOtherinDO> list = getSqlMapClientTemplate().queryForList("LogicWarehouseOtherin_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehouseOtherin_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehouseOtherin_ex.deleteBizRemoved", id);
        return count;
	}

}